import time

try:
    f = open('test.txt')
    try:
        while True:
            content = f.readline()
            if not content:
                break
            time.sleep(2)
            print(content.rstrip())
    except KeyboardInterrupt:
        print('程序被意外终止')
    finally:
        print('文件关闭')
        f.close()
except FileNotFoundError:
    print('文件不存在')
finally:
    print('程序结束')
